<?php
include_once "src/controller/regmanagement/AdminManager.php";
include_once "src/controller/regmanagement/MiscellaneousManager.php";
include_once "src/model/Service.php";
include_once "src/regexception/DBConnectionException.php";
include_once "src/regexception/DBException.php";
include_once "src/regexception/GeneralRegistryException.php";

try {
    $services = MiscellaneousManager::getServices();

    if (count($services) == 0) {
?>
        <div style="padding-top:10px;padding-bottom:10px;text-align:center;font-weight:bold;">
            There are 0 categories registered on the system.
        </div>
<?php
    }

    for ($i = 0 ; $i < count($services) ; $i++) {
        $service = $services[$i];
        if (($i % 2) == 0) {
?>
            <div id="category<?php echo $service->getServiceId(); ?>" style="float:left;padding:5px;text-align:left;background-color:#FFFFFF;border-bottom:1px solid #CCCCCC;">
<?php            
        } else {
?>
            <div id="category<?php echo $service->getServiceId(); ?>" style="float:left;padding:5px;text-align:left;background-color:#FFFFFF;border-bottom:1px solid #CCCCCC;">
<?php            
        }
?>
            <div id="categoryLabel<?php echo $service->getServiceId(); ?>"
                 style="float:left;width:370px;overflow:hidden;">
                <?php echo $service->getServiceName(); ?>
            </div>
            <div style="float:left;">
                <img src="images/icons/editIcon_1.png"
                     style="cursor:pointer;"
                     onclick="javascript:showModifyCategoryForm(<?php echo $service->getServiceId(); ?>)"/>
                <img src="images/icons/deleteIcon_1.png"
                     style="cursor:pointer;padding-left:5px;"
                     onclick="javascript:deleteCategory(<?php echo $service->getServiceId(); ?>)"/>
            </div>
        </div>
<?php
    }
} catch (Exception $e) {
    echo $e->getMessage();
}
?>